
package at.fhj.ase.crypto.common.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Class simplifying logger calls by automated instance creation
 * 
 * @author sfe | www.fh-joanneum.at | Practical Aspects of Cryptography
 */
public final class LogUtil {
  public static Logger getLogger() {
    final StackTraceElement stackTraceElement = Thread.currentThread().getStackTrace()[2];
    return getLogger(stackTraceElement.getClassName());
  }

  public static Logger getLogger(final Object instance) {
    return getLogger(instance.getClass().getName());
  }

  /** @return {@link LoggerFactory#getLogger(String)} with the specified <code>className</code> */
  public static Logger getLogger(final String className) {
    return LoggerFactory.getLogger(className);
  }

  private LogUtil() {
    throw new AssertionError("LogUtil: Util classes are not intended/allowed to be instantiated!");
  }
}
